import json


class UserInfo:
    def __init__(self, id, username, email, registration_date):
        self.id = id
        self.username = username
        self.email = email
        self.registration_date = registration_date

    def __str__(self):
        return f"ID: {self.id}, Username: {self.username}, Email: {self.email}, Registration Date: {self.registration_date}"

    # 读取json.txt中的信息


with open('json.txt', 'r') as file:
    data = json.load(file)

# 数据封装并存入列表
users = []
for user_data in data:
    user = UserInfo(user_data['id'], user_data['username'], user_data['email'], user_data['registration_date'])
    users.append(user)

# 遍历列表输出所有的用户信息
for user in users:
    print(user)